int switchState =0;
int incoming = 0;

void setup(){
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11, INPUT);
Serial.begin(9600);
}


void loop(){
  
  switchState = digitalRead(11);
  
  if (Serial.available() > 0) {
                incoming = Serial.read();
                // say what you got:
                Serial.print("I received: ");
                Serial.println(incoming, DEC);
  }
  
  
 // lock or unlock
  switch (switchState) {
    case HIGH: //lock
        if(incoming == 76){
          //door close
          digitalWrite (9, HIGH);
          delay(1000);
          digitalWrite (10, HIGH);
          delay(1000);
          digitalWrite (10, LOW);
          delay(1000);
          digitalWrite (10, LOW);
          break;
        }
        if(incoming == 85){
          digitalWrite (9, HIGH);
          delay(1000);
          digitalWrite (10, HIGH);
          delay(1000);
          digitalWrite (10, LOW);
          delay(1000);
          digitalWrite (10, HIGH);
          delay(1000);
          digitalWrite (10, LOW);
          break;
        }
        break;

    case LOW: //unlock
    
         digitalWrite (9, LOW);
         digitalWrite (10, LOW); 
         break;
        
      
  }

    
 
  
  

  }
